<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1.reset参数
        // 剩余的参数作为user对象传入 ...user只能写在最后
        function connect({ host, port, ...user }) {
            console.log(host);
            console.log(port);
            console.log(user);
        }

        connect({
            host: '127.0.0.1',
            port: 3306,
            username: 'root',
            password: 'root',
            type: 'master'
        });

        // 2.拓展运算符
        const skill1 = {
            q:'天音波'
        }
        const skill2 = {
            w:'金钟罩'
        }
        const skill3 = {
            e:'天雷蛇'
        }
        const skill4 = {
            r:'神龙摆尾'
        }
        // 将四个对象合并成一个对象
        const hero = {...skill1,...skill2,...skill3,...skill4}
        console.log(hero);
    </script>
</body>

</html>